#include <iostream>
#include "Xml.h"
#include "Parser.h"
using namespace sf::xml;

int main(int argc, char *argv[])
{
    Xml root;
    root.load("./test.xml");
    const string &param_value = root["context-param"]["type"]["param-value"].text();
    cout << param_value << endl;
    cout << root.name() << endl;
    cout << endl;

    const string &xmlns = root.attr("xmlns");
    cout << xmlns << endl;
    const string &str = root["context-param"]["type"].attr("class");
    cout << str << endl;
    cout << endl;

    // for (auto it = root["context-param"]["type"].begin(); it != root["context-param"]["type"].end(); it++)
    // {
    //     cout << it->name() << ": " << it->text() << endl;
    // }

    for (int i = 0; i < root["context-param"]["type"].size(); i++)
    {
        cout << root["context-param"]["type"][i].name() << " ==> " << root["context-param"]["type"][i].text() << endl;
    }
    cout << endl;

    // root.save("./temp.xml");
    // cout << root.str() << endl;
    return 0;
}